class Animal {
    // name: string;
    // age: number;

    constructor(public name: string, public age: number) {
        this.name = name;
        this.age = age;
    }

    eat() {
        console.log(`${this.name}吃东西`);
    }
}

class Cat extends Animal {
    // constructor(name: string, age: number) {
    //     super(name, age);
    // }
    // sex: string

    constructor(name: string, age: number, public sex: string) {
        super(name, age);
        this.sex = sex
    }

    catchMouse() {
        console.log(`${this.name}抓老鼠`);
    }
}

let cat = new Cat("小白", 2, "公")
cat.catchMouse()
